﻿namespace ZSoftInstagram.UI.Web.Infrastructure.AppEvents
{
    public class RegisterDefaultUser : IAppEventHandler
    {
        public AppEventType EventType
        {
            get
            {
                return AppEventType.Application_Start;
            }
        }

        public void Execute()
        {
            ////TODO: Implement this Method #1 priority
            //var model = new RegisterViewModel() { Email = "a@b.com", Password = "123", ConfirmPassword = "123" };

            //var user = new ApplicationUser { UserName = model.Email, Email = model.Email };

            //var context = new ApplicationDbContext();
            //var userStore = new CustomUserStore(context);
            //var owinContext = new OwinContext();

            //var manager = new ApplicationUserManager(userStore); // owinContext.GetUserManager<ApplicationUserManager>();
            //var result = manager.Create(user, model.Password);
            //var signManager = new ApplicationSignInManager(manager, owinContext.Authentication);

            //signManager.SignInAsync(user, isPersistent: false, rememberBrowser: false).Wait();
        }
    }
}
